package com.kingsoft.dc.khaos.module.spark.model.TechCheck;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

public class Field implements Serializable {
    @Getter
    @Setter
    String fieldname;
    @Getter
    @Setter
    String fieldtype;
    @Getter
    @Setter
    int isfixedlength;
    KsyunCheckRule ksyunCheckRule;
    public Field(String fieldname,String fieldtype,int isfixedlength){
      this.fieldname = fieldname;
      this.fieldtype = fieldtype;
      this.isfixedlength = isfixedlength;
      this.ksyunCheckRule = KsyunCheckRule.ddlDataTypeParse(fieldtype,isfixedlength);
    }

    //    Tuple4 说明 ：1原始值 2替换值 3触发的检核规则 4告警信息
    public Tuple4<String, String, KsyunErrorCode,String> check(String value){
        return ksyunCheckRule.check(value);
    }

}